package MeteoCal.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @authors Guttadoro, Iommazzo, Saullo
 */
@Entity
@Table(name = "weatherforecast")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = Weatherforecast.findAll, query = "SELECT w FROM Weatherforecast w"),
    @NamedQuery(name = "Weatherforecast.findByIdWeatherForecast", query = "SELECT w FROM Weatherforecast w WHERE w.idWeatherForecast = :idWeatherForecast"),
    @NamedQuery(name = "Weatherforecast.findByDate", query = "SELECT w FROM Weatherforecast w WHERE w.date = :date"),
    @NamedQuery(name = Weatherforecast.findByDescription, query = "SELECT w FROM Weatherforecast w WHERE w.description = :description"),
    @NamedQuery(name = Weatherforecast.findByCityAndDate, query = "SELECT w FROM Weatherforecast w WHERE w.city = :city and w.date = :date"),
    @NamedQuery(name = Weatherforecast.findByCity, query = "SELECT w FROM Weatherforecast w WHERE w.city = :city")})
public class Weatherforecast implements Serializable {
    
    public static final String findAll = "Weatherforecast.findAll";
    public static final String findByDescription = "Weatherforecast.findByDescription";
    public static final String findByCity = "Weatherforecast.findByCity";
    public static final String findByCityAndDate = "Weatherforecast.findByCityAndDate";
    
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idWeatherForecast")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer idWeatherForecast;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "Description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "City")
    private String city;
    private String result_country;
    private String result_description; // main tempo in generale.description tempo in particolare
    private String result_icon;

    public String getResult_icon() {
        return result_icon;
    }

    public void setResult_icon(String result_icon) {
        this.result_icon = result_icon;
    }

    public String getResult_country() {
        return result_country;
    }

    public void setResult_country(String result_country) {
        this.result_country = result_country;
    }

    public String getResult_description() {
        return result_description;
    }

    public void setResult_description(String result_description) {
        this.result_description = result_description;
    }    
    // in toeoria da aggiungere o da togliere. nel database non vengono salvate per ora
    
    public Weatherforecast() {
    }

    public Weatherforecast(Integer idWeatherForecast) {
        this.idWeatherForecast = idWeatherForecast;
    }

    public Weatherforecast(Integer idWeatherForecast, Date date, String description, String city, String result_name,String result_country,Double result_lon,Double result_lat,String dt_txt,int result_id,
                            String result_main,String result_description,int result_sunrise,int result_sunset,String result_icon) {
        this.idWeatherForecast = idWeatherForecast;
        this.date = date;
        this.description = description;
        this.city = city;
        this.result_country = result_country;
        this.result_description= result_description;
        this.result_icon= result_icon;
    }

    public Integer getIdWeatherForecast() {
        return idWeatherForecast;
    }

    public void setIdWeatherForecast(Integer idWeatherForecast) {
        this.idWeatherForecast = idWeatherForecast;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idWeatherForecast != null ? idWeatherForecast.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Weatherforecast)) {
            return false;
        }
        Weatherforecast other = (Weatherforecast) object;
        if ((this.idWeatherForecast == null && other.idWeatherForecast != null) || (this.idWeatherForecast != null && !this.idWeatherForecast.equals(other.idWeatherForecast))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MeteoCal.entity.Weatherforecast[ idWeatherForecast=" + idWeatherForecast + " ]";
    }
    
}
